/**基本物件基类 scene layer sprite等全由此类派生
 * @date   2011-4-8
 * @author tianye
 */
package cn.edu.dlut.WingGame.Object;

import java.util.Hashtable;

import cn.edu.dlut.WingGame.BaseType.ObjectState;
import cn.edu.dlut.WingGame.BaseType.ObjectType;

public abstract class WingObject {
	private static int IDCount = 0;
	private static Hashtable<String, Integer> NameList = new Hashtable<String, Integer>();

	public static int NameToID(String name) {
		return NameList.get(name);
	}

	public int mID;
	public String mName;
	public ObjectType mType = ObjectType.WING_UNDEFINED;
	public ObjectState mState = ObjectState.normal;

	public WingObject() {
		IDCount++;
		mID = IDCount;
		mName = new String();
		mName = "id_" + mID;
		NameList.put(mName, mID);
	}

	public WingObject(String name) {
		IDCount++;
		mID = IDCount;
		mName = name;
		NameList.put(mName, mID);
	}

	public void setName(String name) {
		NameList.remove(mName);
		mName = name;
		NameList.put(mName, mID);
	}

	public int getID() {
		return mID;
	}

	public void setState(ObjectState state) {
		mState = state;
	}

	public ObjectState getState() {
		return mState;
	}

	public abstract void update();

	public abstract void render();

}
